package cn.edu.nuc.crm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.edu.nuc.crm.dao.RepayMapper;
import cn.edu.nuc.crm.dto.PageInfo;
import cn.edu.nuc.crm.entity.Application;
import cn.edu.nuc.crm.entity.Repay;
import cn.edu.nuc.crm.service.interfaces.RepayService;
@Service
public class RepayServiceImpl implements RepayService {
	@Autowired
	private RepayMapper repayMapper;
	@Override
	public PageInfo selectByCountId(int current, Integer accountid) {
		// TODO Auto-generated method stub
		PageInfo pi = new PageInfo(current);
		int count = repayMapper.getCountId(accountid);
		pi.setCount(count);
		List<Repay> findByid=repayMapper.findCountId(accountid,pi.getStart(), pi.getOffset());
		System.out.println("总的记录数:"+count+"--"+pi);
		pi.setList(findByid);
		return pi;
	}
	@Override
	public void updateByPrimaryKey(Repay repay) {
		// TODO Auto-generated method stub
		repayMapper.updateByPrimaryKey(repay);
	}
	@Override
	public void insert(Repay repay) {
		// TODO Auto-generated method stub
		repayMapper.insert(repay);
	}
	@Override
	public PageInfo select(int current) {
		PageInfo pi = new PageInfo(current);
		int count = repayMapper.getCount();
		pi.setCount(count);
		List<Repay> findByid=repayMapper.findCount(pi.getStart(), pi.getOffset());
		System.out.println("总的记录数:"+count+"--"+pi);
		pi.setList(findByid);
		return pi;
	}
	@Override
	public Repay selectByPrimaryKey(Repay repay) {
		// TODO Auto-generated method stub
		Repay mrepay = (Repay)repayMapper.selectByPrimaryKey(repay.getId());
		return mrepay;
	}

}
